#ifndef CONNECTION_H
#define CONNECTION_H

#include <QtSql>
#include <QSqlDatabase>

static bool createConnection()
{
	QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
	db.setDatabaseName("wj78080458");
	if(!db.open())
		return false;

	QSqlQuery query;
	query.exec("create table person(id int primary key, firstname varchar(20), lastname varchar(20))");
	query.exec("insert into person values(101, 'wj', 'weijie')");
	query.exec("insert into person values(102, 'dd', 'dddddd')");
	query.exec("insert into person values(103, 'tl', 'tangliang')");
	return true;
}

#endif

